Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

deCamera.hpp

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////////////////////////
00002 /// @file deCamera.hpp
00003 ///
00004 /// @brief Viewport & Rendering Data
00005 ///
00006 /// @author Assassin
00007 ///
00008 /// This file is the intellectual property of Novus Delta, LLC.. Usage of the
00009 /// contents of this file is subject to the Destiny3D Member License which
00010 /// can be found at http://www.destiny3d.com.  Any other usage is prohibited.
00011 ///
00012 /// This file is distributed "AS IS" without warranty of any kind.  Novus
00013 /// Delta, LLC. does not guarantee the fitness of the contents of this file
00014 /// for any particular purpose.
00015 ///
00016 /// Copyright (C) 2001-2003 Novus Delta, LLC. All Rights Reserved.
00017 ///
00018 /// <hr>
00019 ///                                 Change History
00020 /// <hr>
00021 ///
00022 /// @date Jan 2002
00023 /// @author Assassin
00024 /// @remarks Creation
00025 ///
00026 ///////////////////////////////////////////////////////////////////////////////
00027 
00028 #ifndef DECAMERA_HPP
00029 #define DECAMERA_HPP
00030 
00031 #include "deGlobalTypes.hpp"
00032 #include "deMath.hpp"
00033 #include "deScene.hpp"
00034 
00035 #define DECAMERA_API DESCENE_API
00036 
00037 class IdeCamera;
00038 class IdePlaneFrustum;
00039 
00040 // factory functions
00041 /// Create an instance of IdeCamera
00042 DECAMERA_API IdeCamera * IdeCamera_CreateCamera();
00043 DECAMERA_API IdeCamera * IdeCamera_CreateCameraFromRef(IdeCamera* ref);
00044 /// Create an instance of IdePlaneFrustum
00045 DECAMERA_API IdePlaneFrustum * IdeFrustum_CreatePlaneFrustum();
00046 
00047 typedef IdeCamera * (*fIdeCamera_CreateCamera)();
00048 typedef IdeCamera * (*fIdeCamera_CreateCameraFromRef)(IdeCamera* ref);
00049 
00050 /// Essentially a storage class to interface deRender & deScene - stores things related to the screen view.
00051 /// Related functions: IdeCamera_CreateCamera
00052 //class IdeCamera
00053 DE3D_INTERFACE_(IdeCamera)
00054 {
00055 protected:
00056     virtual ~IdeCamera(void) {}
00057 public:
00058     /// deletes the object
00059     virtual long Release() = 0;
00060 
00061     /// Match the camera with a window handle. Multiple cameras may share a window handle
00062     virtual void SetWindow(HWND window) = 0;
00063     /// Set the client rect of the camera's viewport, which the scene will be rendered into
00064     virtual void SetRect(deRect rect) = 0;
00065     /// Set the horizontal Field-of-View of the camera, in degrees
00066     virtual void SetFOV(deDouble Degrees) = 0;
00067     /// Set the screen aspect ratio (AspectRatio = 4/3 or 16/9, defaults to 4/3)
00068     virtual void SetScreenAspect(long PixelWidth, long PixelHeight, deDouble AspectRatio) = 0;
00069     /// Set the near and far clip planes of the camera's viewport
00070     virtual void SetClip(deDouble Near, deDouble Far) = 0;
00071     virtual void FogEnable(deBoolean Enable) = 0;
00072     virtual void SetFog(deFloat Near, deFloat Far, deARGB Color, deBoolean RangeFog = deFALSE) = 0;
00073     /// Set the width of the camera, if it will be an orthographic projection
00074     virtual void SetOrthoWidth(deDouble Width) = 0;
00075     /// Enable or disable an orthographic (parallel) projection mode
00076     virtual void EnableOrtho(deBoolean OrthoEnable) = 0;
00077     /// Build a frustum from this camera based on its rect and transform
00078 //  virtual void BuildRootFrustum(deFrustum &f) = 0;
00079     /// Build a frustum from this camera based on its rect and transform
00080     virtual deBoolean BuildRootFrustum(IdePlaneFrustum * pFrustum) = 0;
00081     /// Retrieve a vector in world-space corresponding to a screen position.
00082     /// @return a vector (with Z=1) pointing from the camera's translation along the
00083     ///          ray that coincides with the point selected on the near clip plane
00084     /// @param a pointer to a vector in which to store the start point of the ray
00085     virtual deVec3d ScreenPointToWorldVec(int x, int y, deVec3d *StartPosition) = 0;
00086     /// Transforms a 3D world position into an (x,y) pair on the screen
00087     virtual deBoolean WorldPosToScreenPos(const deVec3d &pos, int &x, int &y) = 0;
00088     /// Clips a screen rect to the input frustum
00089     /// @return deTrue if successful, deFalse otherwise
00090     /// @param Frustum a valid deFrustum object to be used in clipping a screen-rect
00091     /// @param ScreenRect a deRect filled with valid screen positions, to be clipped down to
00092     ///                   the screen-size of Frustum
00093 //  virtual deBoolean FrustumRect(const deFrustum & Frustum, deRect & ScreenRect) = 0;
00094     virtual deBoolean FrustumRect(const IdePlaneFrustum * pFrustum, deRect & ScreenRect) = 0;
00095 
00096     /// Retrieve the associated window handle
00097     virtual HWND GetWindow() = 0;
00098     /// Retrieve the screenrect the camera is using
00099     virtual deRect GetRect() = 0;
00100     /// Retrieve the horizontal Field-of-View of the camera, in degrees
00101     virtual deDouble GetFOV() = 0;
00102     /// Retrieve the vertical Field-of-View of the camera, in radians
00103     /// @param Aspect the aspect ratio of the viewport being used. (Aspect = Width/Height).
00104     ///               This will be filled with the current "Locked" Aspect if one is set
00105     virtual deDouble GetFOVy(deDouble &Aspect) = 0;
00106     /// Retrieve the near clip plane distance
00107     virtual deDouble GetNearClip() = 0;
00108     /// Retrieve the far clip plane distance
00109     virtual deDouble GetFarClip() = 0;
00110     /// Retrieve the orthogrpahic width of the camera
00111     virtual deDouble GetOrthoWidth() = 0;
00112     /// Tell whether the camera is using an orthographic projection or not
00113     /// @return deTrue if an orthographic projection is in use
00114     virtual deBoolean IsOrtho() = 0;
00115     virtual deBoolean GetFog(deFloat& Near, deFloat& Far, deARGB& Color, deBoolean& RangeFog) = 0;
00116 
00117     /// Used to lock the aspect of a camera in order to cause a distorted image to render.
00118     /// The return value from GetFOVy will be unaffected by the Aspect actually fed to it.
00119     /// @param Aspect An aspect ratio to lock the camera into using. Use a negative value to unlock.
00120     virtual void LockAspect(deDouble Aspect) = 0;
00121 
00122     /// The current transformation of the camera
00123     /// @return a reference to the camera's internal transform, instead of a Get/Set pair.
00124     virtual deTransformInfo & Position() = 0;
00125 };
00126 
00127 /// class for storing a view frustum with arbitrary planes forming a convex view volume.
00128 /// Related functions: IdeFrustum_CreatePlaneFrustum.
00129 //class IdePlaneFrustum
00130 DE3D_INTERFACE_(IdePlaneFrustum)
00131 {
00132 protected:
00133     virtual ~IdePlaneFrustum() {}
00134 public:
00135     virtual long Release() = 0;
00136 
00137     virtual deBoolean CreateFromPolygon(const deVec3d * PointArray, long NumPoints, const deVec3d & Position) = 0;
00138     virtual deBoolean CopyFromFrustum(const IdePlaneFrustum* Ref) = 0;
00139 
00140     virtual deBoolean Optimize() = 0;
00141 
00142     virtual deBoolean IsOrtho() const = 0;
00143     virtual void SetOrtho(deBoolean Ortho) = 0;
00144 
00145     virtual u32  GetNumPlanes() const = 0;
00146     virtual void SetNumPlanes(u32 NumPlanes) = 0;
00147 
00148     virtual void AddPlane(const dePlane & plane) = 0;
00149 
00150     virtual void GetPlane(u32 index, dePlane & plane) const = 0;
00151     virtual void SetPlane(u32 index, const dePlane & plane) = 0;
00152 
00153     virtual void SetInVec(const deVec3d & InVec) = 0;
00154     virtual void SetPosVec(const deVec3d & PosVec) = 0;
00155     virtual void SetDists(const deDouble & Min, const deDouble & Max) = 0;
00156     virtual deDouble GetMinDist() const = 0;
00157     virtual deDouble GetMaxDist() const = 0;
00158 
00159     virtual deBoolean TestSphereInside(const deBoundSphere& Sphere, const deVec3d& WorldPos, deBoolean & AllInside) const = 0;
00160     virtual deBoolean TestAABBInside(const deAABB& BBox, const deVec3d& WorldPos, deBoolean & AllInside) const = 0;
00161 };
00162 
00163 #endif

Generated on Mon Sep 12 19:58:24 2005 for Destiny3D by doxygen1.3-rc3